package org.example.web;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

/**
 * @description: 测试类
 * @author: yh
 * @date: 2022/12/12
 */
@RequestMapping(value = "test")
@RestController
public class TestController {

    @GetMapping(value = "/get")
    public String get(){
        LocalDateTime now = LocalDateTime.now();
        int number = Integer.parseInt("1");
        ArrayList<String> list = new ArrayList<>();
        Map<String, String> map = new HashMap<>();
        restRequest();
        restRequest2();
        return "hello arthas";
    }

    /**
     * 模拟网络请求
     * @author: yh
     * @date: 2022/12/12
     */
    private void restRequest(){
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }
    /**
     * 模拟网络请求
     * @author: yh
     * @date: 2022/12/12
     */
    private void restRequest2(){
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }
}
